#include "stm32f10x.h"                  // Device header
void Timer_Init(void)
{	
	TIM_InternalClockConfig(TIM3);
	
	TIM_TimeBaseInitTypeDef  TIM_TimeBaseInitStructure;
	TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1 ;
	TIM_TimeBaseInitStructure.TIM_CounterMode =TIM_CounterMode_Up ;
	TIM_TimeBaseInitStructure.TIM_Period =9999 ;
	TIM_TimeBaseInitStructure.TIM_Prescaler = 7200-1;
	TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
	TIM_TimeBaseInit(TIM3,&TIM_TimeBaseInitStructure);
	
	TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE);
	
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	
	NVIC_InitTypeDef NVIC_Initstructure;
	NVIC_Initstructure.NVIC_IRQChannel =  TIM3_IRQn;
	NVIC_Initstructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Initstructure.NVIC_IRQChannelPreemptionPriority =2 ;
	NVIC_Initstructure.NVIC_IRQChannelSubPriority = 1;
  NVIC_Init(&NVIC_Initstructure);
	
	TIM_Cmd(TIM3,ENABLE); 

}



	